/*
 Copyright (c) 2000-2001, Neil Rhodes and Julie McKeehan
   neil@pobox.com
 All rights reserved.

From the book "Palm Programming, the Developer's Guide, 2nd edition"
by O'Reilly.

Permission granted to use this file however you see fit.
*/

#define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS
#include <BuildDefines.h>
#ifdef DEBUG_BUILD
#define ERROR_CHECK_LEVEL ERROR_CHECK_FULL
#endif
#include <PalmOS.h>
#include "ResourceDefines.h"
#include "SecondForm.h"


static 
void SecondFormInit(FormPtr form)
{
#pragma unused(form)
  // warning-- don't do any drawing in this routine.
  // Also, don't call FrmSetFocus from here (it must be called *after*
  // FrmDrawForm)
}

static 
void SecondFormDeinit(FormPtr form)
{
#pragma unused(form)
}


Boolean SecondFormHandleEvent(EventPtr event)
{
  Boolean handled = false;
  FormPtr form;


  switch (event->eType) {
  case frmOpenEvent:
    form = FrmGetActiveForm();
    SecondFormInit(form);
    FrmDrawForm(form);
    // here's where you'd add a call to FrmSetFocus
    handled = true;
    break;
      
      
  case ctlSelectEvent:
    switch (event->data.ctlSelect.controlID) {
    case SecondGotoMainFormButton:
      FrmGotoForm(MainForm);
      handled = true;
      break;
    }
    break;

  case frmCloseEvent:
    SecondFormDeinit(FrmGetActiveForm());
    handled = false;
    break;

  default:
    break;
  }
  
  return handled;
}
